package com.ssm.service.impl;

import java.util.HashMap;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssm.mapper.LoginMapper;
import com.ssm.model.LoginInfo;
import com.ssm.service.LoginService;

@Service
public class LoginServiceImpl implements LoginService {

	@Autowired
	private LoginMapper loginMapper;
	
	@Override
	public LoginInfo selectByUserName(String username) {
		// TODO Auto-generated method stub
		Integer loginId = Integer.valueOf(username);
		return loginMapper.selectByUserName(loginId);
	}

	@Override
	public Set<String> findRoles(String username) {
		// TODO Auto-generated method stub
		Integer loginId = Integer.valueOf(username);
		return loginMapper.findRoles(loginId);
	}

	@Override
	public Integer resetPwd(String password, Integer loginId) {
		// TODO Auto-generated method stub
		HashMap map = new HashMap<>();
		map.put("password", password);
		map.put("loginId", loginId);
		return loginMapper.resetPwd(map);
	}
	

	
}
